<!DOCTYPE html> <title>Prevent Overflow Visual Test</title>

<style>
  @import '/reset.css';

  #popper {
    width: 100px;
    height: 50px;
    background-color: rebeccapurple;
    box-shadow: inset 0 0 0 1px black;
  }

  #arrow {
    width: 20px;
    height: 20px;
    background-color: yellow;
  }

  #canvas {
    position: fixed;
    left: 100px;
    top: 100px;

    width: 400px;
    height: 400px;
    border: 1px solid black;
  }
</style>

<svg id="canvas" viewBox="-50 -50 100 100">
  <rect id="reference" x="-100" y="0" width="100" height="25" fill="red" />
</svg>
<div id="reference">Reference Box</div>
<div id="popper">
  Popper Box
  <div id="arrow" data-popper-arrow></div>
</div>

<script type="module">
  import { createPopper } from '../../dist/popper.js';
  const reference = document.querySelector('#reference');
  const popper = document.querySelector('#popper');

  window.instance = createPopper(reference, popper, {
    placement: 'top',
    modifiers: [
      {
        name: 'preventOverflow',
        options: {
          boundary: document.querySelector('svg'),
        },
      },
    ],
  });
</script>
